package com.dongdongshop.config;


import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AlipayConfig {
    @Value("${alipay.public_key}")
    private String publicKey;

    @Value("${alipay.charset}")
    private String charset;

    @Value("${alipay.sign_type}")
    private String signType;

    @Value("${alipay.server_url}")
    private String serverUrl;

    @Value("${alipay.appId}")
    private String appId;

    @Value("${alipay.privateKey}")
    private String privateKey;

    @Value("${alipay.format}")
    private String format;

    @Bean
    public AlipayClient alipay() {
        AlipayClient alipayClient = new DefaultAlipayClient(serverUrl, appId,privateKey, format,charset,publicKey,signType);
        return alipayClient;
    }
}
